#define _CRT_SECURE_NO_WARNINGS 1
#include "SList.h"

void SLTest1()
{
	SListNode* plist = NULL;
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPrint(plist);

	SLPopBack(&plist);
	SLPopBack(&plist);
	SLPrint(plist);
}

void SLTest2()
{
	SListNode* plist = NULL;
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);
	SLPrint(plist);

	SLPopFront(&plist);
	SLPopFront(&plist);
	SLPrint(plist);
}

void SLTest3()
{
	SListNode* plist = NULL;
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPrint(plist);

	SListNode* pos = SLFindNode(plist,4);
	SLInsertAfter(pos,10);
	SLPrint(plist);
	SLEraseAfter(pos);
	SLPrint(plist);

}

void SLTest4()
{
	SListNode* plist = NULL;
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPrint(plist);

	SListNode* pos = SLFindNode(plist, 1);
	SLInsertBefore(&plist, pos, 10);
	SLPrint(plist);

	SLErase(&plist,pos);
	SLPrint(plist);

	SLDestroy(&plist);

}

int main()
{
	SLTest4();
	return 0;
}